#include <stdio.h>
#define MAXSIZE 20

typedef struct student
{
    char name[8];
    float score;
} student;
int Partition(student *stus, int low, int high)
{
    student pivot = stus[low]; // 第一个元素作为枢轴
    while (low < high)
    {
        while (low < high && stus[high].score >= pivot.score)
            --high;
        stus[low] = stus[high]; // 比枢轴小的元素移动到左端
        while (low < high && stus[low].score <= pivot.score)
            ++low;
        stus[high] = stus[low]; // 比枢轴大的元素移动到右端；
    }
    stus[low] = pivot; // 枢轴最终位置
    return low;              // 返回枢轴最终位置
}
void Quicksort(student *stus, int low, int high)
{
    if (low < high)
    {
        int pivot = Partition(stus, low, high);
        Quicksort(stus, low, pivot - 1);
        Quicksort(stus, pivot+1, high);
    }
}
int main()
{
    student stus[MAXSIZE];
    int p = 0; // 指向当前学生下标
    int s = 1; // 指向学生排名
    while (1)
    {
        student stu;
        scanf("%s %f", stu.name, &stu.score);
        fflush(stdin); // 清除缓冲区
        if (stu.name[0] == '0' && stu.score == 0)
            break;
        stus[p++] = stu;
    }                            // 录入学生信息
    p--;                         // 指向最后一个学生
    Quicksort(stus, 0, p);
    for (int i = p; i >= 0; i--) // 打印学生信息(从大到小)
        printf("%d %s %.2f\n", s++, stus[i].name, stus[i].score);
    s--; // 指向最后一名
    return 0;
}
